<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>Ajax | 我的笔记</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-emphasize/plugin.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-expandable-chapters/expandable-chapters.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-prism/prism-solarizedlight.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
    

        
    
    
    <link rel="next" href="../Ajax/Ajax的实现过程.html" />
    
    
    <link rel="prev" href="../DOM/5、移动端事件.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="9"
        data-chapter-title="Ajax"
        data-filepath="Ajax/Ajax.md"
        data-basepath=".."
        data-revision="Mon Oct 22 2018 12:05:33 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Introduction
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="gitbook的安装.html">
            
                
                    <a href="../gitbook的安装.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        gitbook的安装
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2" data-path="HTML and CSS/1、css的引入方式.html">
            
                
                    <a href="../HTML and CSS/1、css的引入方式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        HTML and CSS
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="HTML and CSS/3、常用的标签.html">
            
                
                    <a href="../HTML and CSS/3、常用的标签.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        常用的标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="HTML and CSS/4、表格的使用.html">
            
                
                    <a href="../HTML and CSS/4、表格的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        表格的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="HTML and CSS/5、表单.html">
            
                
                    <a href="../HTML and CSS/5、表单.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        表单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="HTML and CSS/6、a标签的使用.html">
            
                
                    <a href="../HTML and CSS/6、a标签的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        a标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="HTML and CSS/7、盒子模型.html">
            
                
                    <a href="../HTML and CSS/7、盒子模型.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        盒子模型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="HTML and CSS/8、浮动.html">
            
                
                    <a href="../HTML and CSS/8、浮动.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        浮动
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="HTML and CSS/9、css常见问题.html">
            
                
                    <a href="../HTML and CSS/9、css常见问题.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.</b>
                        
                        css常见问题
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="HTML and CSS/10、位置定位.html">
            
                
                    <a href="../HTML and CSS/10、位置定位.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.8.</b>
                        
                        位置定位
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="HTML and CSS/11、阴影设置.html">
            
                
                    <a href="../HTML and CSS/11、阴影设置.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.9.</b>
                        
                        阴影设置
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.10" data-path="HTML and CSS/12、自定义动画.html">
            
                
                    <a href="../HTML and CSS/12、自定义动画.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.10.</b>
                        
                        动画
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.11" data-path="HTML and CSS/13、容器居中方法.html">
            
                
                    <a href="../HTML and CSS/13、容器居中方法.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.11.</b>
                        
                        容器居中
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.12" data-path="HTML and CSS/14、fullpage的使用.html">
            
                
                    <a href="../HTML and CSS/14、fullpage的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.12.</b>
                        
                        fullpage的使用
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="移动端/移动端.html">
            
                
                    <a href="../移动端/移动端.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        移动端
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="移动端/1、关于移动端.html">
            
                
                    <a href="../移动端/1、关于移动端.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        关于移动端
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="移动端/2、移动端小问题.html">
            
                
                    <a href="../移动端/2、移动端小问题.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        移动端小问题
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="flex布局/flex.html">
            
                
                    <a href="../flex布局/flex.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        flex弹性盒子
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="flex布局/1、flex布局.html">
            
                
                    <a href="../flex布局/1、flex布局.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        flex布局
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="响应式布局/bootstrap.html">
            
                
                    <a href="../响应式布局/bootstrap.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        响应式布局
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="响应式布局/1、Bootstrap.html">
            
                
                    <a href="../响应式布局/1、Bootstrap.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        Bootstrap
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="响应式布局/2、媒体查询.html">
            
                
                    <a href="../响应式布局/2、媒体查询.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        媒体查询
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6" data-path="JavaScript/JavaScript.html">
            
                
                    <a href="../JavaScript/JavaScript.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        JavaScript
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1" data-path="JavaScript/1、JavaScript数据类型.html">
            
                
                    <a href="../JavaScript/1、JavaScript数据类型.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.</b>
                        
                        JS数据类型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="JavaScript/2、数据类型的转换.html">
            
                
                    <a href="../JavaScript/2、数据类型的转换.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.</b>
                        
                        数据类型的转换
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="JavaScript/3、运算符.html">
            
                
                    <a href="../JavaScript/3、运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.</b>
                        
                        运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="JavaScript/4、赋值运算符.html">
            
                
                    <a href="../JavaScript/4、赋值运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.4.</b>
                        
                        赋值运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.5" data-path="JavaScript/5、比较运算符.html">
            
                
                    <a href="../JavaScript/5、比较运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.5.</b>
                        
                        比较运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.6" data-path="JavaScript/6、逻辑操作符.html">
            
                
                    <a href="../JavaScript/6、逻辑操作符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.6.</b>
                        
                        逻辑操作符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.7" data-path="JavaScript/7、条件运算符.html">
            
                
                    <a href="../JavaScript/7、条件运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.7.</b>
                        
                        条件运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.8" data-path="JavaScript/8、位运算符.html">
            
                
                    <a href="../JavaScript/8、位运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.8.</b>
                        
                        位运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.9" data-path="JavaScript/9、条件语句.html">
            
                
                    <a href="../JavaScript/9、条件语句.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.9.</b>
                        
                        条件语句
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.10" data-path="JavaScript/10、循环语句.html">
            
                
                    <a href="../JavaScript/10、循环语句.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.10.</b>
                        
                        循环语句
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.11" data-path="JavaScript/11、break和continue.html">
            
                
                    <a href="../JavaScript/11、break和continue.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.11.</b>
                        
                        break和continue
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.12" data-path="JavaScript/12、for循环.html">
            
                
                    <a href="../JavaScript/12、for循环.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.12.</b>
                        
                        for循环
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.13" data-path="JavaScript/13、多层循环.html">
            
                
                    <a href="../JavaScript/13、多层循环.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.13.</b>
                        
                        多层循环
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.14" data-path="JavaScript/14、for-in循环.html">
            
                
                    <a href="../JavaScript/14、for-in循环.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.14.</b>
                        
                        for-in循环
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.15" data-path="JavaScript/15、try-catch语句.html">
            
                
                    <a href="../JavaScript/15、try-catch语句.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.15.</b>
                        
                        try-catch语句
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.16" data-path="JavaScript/16、函数.html">
            
                
                    <a href="../JavaScript/16、函数.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.16.</b>
                        
                        函数
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.17" data-path="JavaScript/17、循环排序.html">
            
                
                    <a href="../JavaScript/17、循环排序.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.17.</b>
                        
                        循环排序
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.18" data-path="JavaScript/18、es6语法.html">
            
                
                    <a href="../JavaScript/18、es6语法.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.18.</b>
                        
                        es6语法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.19" data-path="JavaScript/19、数组对象.html">
            
                
                    <a href="../JavaScript/19、数组对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.19.</b>
                        
                        数组对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.20" data-path="JavaScript/20、date对象.html">
            
                
                    <a href="../JavaScript/20、date对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.20.</b>
                        
                        date对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.21" data-path="JavaScript/21、Boolean对象.html">
            
                
                    <a href="../JavaScript/21、Boolean对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.21.</b>
                        
                        Boolean对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.22" data-path="JavaScript/22、数学对象.html">
            
                
                    <a href="../JavaScript/22、数学对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.22.</b>
                        
                        数学对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.23" data-path="JavaScript/23、对象的创建.html">
            
                
                    <a href="../JavaScript/23、对象的创建.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.23.</b>
                        
                        对象的创建
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7" data-path="BOM/BOM.html">
            
                
                    <a href="../BOM/BOM.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                        BOM
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.1" data-path="BOM/1、window对象.html">
            
                
                    <a href="../BOM/1、window对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.1.</b>
                        
                        window对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.2" data-path="BOM/2、navigator对象.html">
            
                
                    <a href="../BOM/2、navigator对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.2.</b>
                        
                        navigator对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.3" data-path="BOM/3、screen对象.html">
            
                
                    <a href="../BOM/3、screen对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.3.</b>
                        
                        screen对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.4" data-path="BOM/4、history对象.html">
            
                
                    <a href="../BOM/4、history对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.4.</b>
                        
                        history对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.5" data-path="BOM/5、location对象.html">
            
                
                    <a href="../BOM/5、location对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.5.</b>
                        
                        location对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.6" data-path="BOM/6、cookie对象.html">
            
                
                    <a href="../BOM/6、cookie对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.6.</b>
                        
                        cookie对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.7" data-path="BOM/7、html5本地存储.html">
            
                
                    <a href="../BOM/7、html5本地存储.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.7.</b>
                        
                        html5本地存储
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="8" data-path="DOM/DOM.html">
            
                
                    <a href="../DOM/DOM.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.</b>
                        
                        DOM
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="8.1" data-path="DOM/1、DOM介绍.html">
            
                
                    <a href="../DOM/1、DOM介绍.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.1.</b>
                        
                        DOM介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.2" data-path="DOM/2、元素对象.html">
            
                
                    <a href="../DOM/2、元素对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.2.</b>
                        
                        元素对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.3" data-path="DOM/3、DOM事件1.html">
            
                
                    <a href="../DOM/3、DOM事件1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.3.</b>
                        
                        DOM事件1
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.4" data-path="DOM/4、DOM事件2.html">
            
                
                    <a href="../DOM/4、DOM事件2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.4.</b>
                        
                        DOM事件2
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8.5" data-path="DOM/5、移动端事件.html">
            
                
                    <a href="../DOM/5、移动端事件.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.5.</b>
                        
                        移动端事件
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter active" data-level="9" data-path="Ajax/Ajax.html">
            
                
                    <a href="../Ajax/Ajax.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.</b>
                        
                        Ajax
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="9.1" data-path="Ajax/Ajax的实现过程.html">
            
                
                    <a href="../Ajax/Ajax的实现过程.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.1.</b>
                        
                        Ajax的实现过程
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="10" data-path="jQuery/jQuery.html">
            
                
                    <a href="../jQuery/jQuery.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.</b>
                        
                        jQuery
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.1" data-path="jQuery/1、选择器和效果.html">
            
                
                    <a href="../jQuery/1、选择器和效果.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.1.</b>
                        
                        选择器和效果
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.2" data-path="jQuery/2、jQuery属性.html">
            
                
                    <a href="../jQuery/2、jQuery属性.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.2.</b>
                        
                        jQuery属性
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.3" data-path="jQuery/3、正则表达式.html">
            
                
                    <a href="../jQuery/3、正则表达式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.3.</b>
                        
                        正则表达式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10.4" data-path="jQuery/4、选择器和操作.html">
            
                
                    <a href="../jQuery/4、选择器和操作.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.4.</b>
                        
                        选择器和操作
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="11" data-path="VUE/vue.html">
            
                
                    <a href="../VUE/vue.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.</b>
                        
                        VUE
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="11.1" data-path="VUE/1、绑定class和style.html">
            
                
                    <a href="../VUE/1、绑定class和style.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.1.</b>
                        
                        绑定class和style
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11.2" data-path="VUE/2、绑定表单.html">
            
                
                    <a href="../VUE/2、绑定表单.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.2.</b>
                        
                        绑定表单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11.3" data-path="VUE/3、组件之间的数据传递.html">
            
                
                    <a href="../VUE/3、组件之间的数据传递.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.3.</b>
                        
                        组件之间的数据传递
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11.4" data-path="VUE/4、vue-router.html">
            
                
                    <a href="../VUE/4、vue-router.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.4.</b>
                        
                        vue-router
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11.5" data-path="VUE/style样式.html">
            
                
                    <a href="../VUE/style样式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.5.</b>
                        
                        style样式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11.6" data-path="VUE/生命周期函数.html">
            
                
                    <a href="../VUE/生命周期函数.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.6.</b>
                        
                        生命周期函数
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11.7" data-path="VUE/vue-resource.html">
            
                
                    <a href="../VUE/vue-resource.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.7.</b>
                        
                        vue-resource
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11.8" data-path="VUE/axios.html">
            
                
                    <a href="../VUE/axios.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.8.</b>
                        
                        axios
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11.9" data-path="VUE/vue动画.html">
            
                
                    <a href="../VUE/vue动画.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.9.</b>
                        
                        vue动画
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11.10" data-path="VUE/插槽的使用.html">
            
                
                    <a href="../VUE/插槽的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.10.</b>
                        
                        插槽的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11.11" data-path="VUE/ajax与框架搭建.html">
            
                
                    <a href="../VUE/ajax与框架搭建.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.11.</b>
                        
                        ajax与框架搭建
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="12" data-path="ES6/ES6.html">
            
                
                    <a href="../ES6/ES6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>12.</b>
                        
                        ES6
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="12.1" data-path="ES6/1、promise.html">
            
                
                    <a href="../ES6/1、promise.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>12.1.</b>
                        
                        promise
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="12.2" data-path="ES6/2、数组的扩展.html">
            
                
                    <a href="../ES6/2、数组的扩展.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>12.2.</b>
                        
                        数组的扩展
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="12.3" data-path="ES6/3、set的使用.html">
            
                
                    <a href="../ES6/3、set的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>12.3.</b>
                        
                        set的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="12.4" data-path="ES6/4、类和类的继承.html">
            
                
                    <a href="../ES6/4、类和类的继承.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>12.4.</b>
                        
                        类和类的继承
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="13" data-path="JS、JQ阻止事件冒泡.html">
            
                
                    <a href="../JS、JQ阻止事件冒泡.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>13.</b>
                        
                        JS、JQ阻止事件冒泡
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="14" data-path="微信小程序/微信小程序.html">
            
                
                    <a href="../微信小程序/微信小程序.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>14.</b>
                        
                        微信小程序
                    </a>
            
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >我的笔记</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="ajax-&#x5168;&#x79F0;asynchronous--javascript--and--xml">ajax &#x5168;&#x79F0;(Asynchronous  JavaScript  And  XML)</h1>
<pre><code>+ ajax&#x7528;&#x4E8E;&#x6570;&#x636E;&#x53D1;&#x9001;&#x8BF7;&#x6C42;&#xFF0C;&#x83B7;&#x53D6;&#x6570;&#x636E;
+ &#x4E0E;&#x9875;&#x9762;&#x7684;&#x5237;&#x65B0;&#x65E0;&#x5173;&#xFF0C;&#x53EA;&#x4F1A;&#x8FDB;&#x884C;&#x5C40;&#x90E8;&#x7684;&#x5237;&#x65B0;&#x3002;
</code></pre><ul>
<li><p>&#x600E;&#x4E48;&#x8FDB;&#x884C;ajax&#x7684;&#x6570;&#x636E;&#x8BF7;&#x6C42;</p>
<ul>
<li>1&#x3001;&#x901A;&#x8FC7;new&#x5173;&#x952E;&#x8BCD;&#x6765;&#x5B9E;&#x4F8B;&#x5316;&#x4E00;&#x4E2A;xmlhttprequest&#x5BF9;&#x8C61;</li>
<li>2&#x3001;&#x8BBE;&#x7F6E;&#x8BF7;&#x6C42;&#x65B9;&#x5F0F;&#x548C;&#x5730;&#x5740;<ul>
<li>open(type,url,async)</li>
<li>type:&#x8BF7;&#x6C42;&#x65B9;&#x5F0F;(get&#xFF0C;post)</li>
<li>url:&#x8BF7;&#x6C42;&#x7684;&#x5730;&#x5740;</li>
<li>async:&#x662F;&#x5426;&#x5F02;&#x6B65;&#x8BF7;&#x6C42;(true:&#x5F02;&#x6B65;&#x3002;false:&#x540C;&#x6B65;)&#x9ED8;&#x8BA4;&#x503C;&#x4E3A;true    </li>
</ul>
</li>
<li>3&#x3001;&#x53D1;&#x9001;&#x8BF7;&#x6C42;send()</li>
<li>4&#x3001;&#x76D1;&#x542C;&#x8BF7;&#x6C42;&#x8FC7;&#x7A0B;&#xFF0C;&#x7136;&#x540E;&#x83B7;&#x53D6;&#x7ED3;&#x679C;</li>
</ul>
</li>
<li><p>&#x8BF7;&#x6C42;&#x6570;&#x636E;&#x65F6;&#xFF0C;&#x5F53;&#x9700;&#x8981;&#x4F20;&#x9012;&#x53C2;&#x6570;&#xFF0C;post&#x8BF7;&#x6C42;&#x4E2D;&#x53EF;&#x5C06;&#x53C2;&#x6570;&#x8BBE;&#x7F6E;&#x5728;send()&#x4E2D;</p>
</li>
<li><p>get&#x8BF7;&#x6C42;&#x53EF;&#x4EE5;&#x62FC;&#x63A5;&#x5728;open&#x7684;url&#x5730;&#x5740;&#x4E0A;&#x3002;</p>
</li>
<li><p>readyState:&#x8868;&#x793A;&#x53D1;&#x9001;&#x8BF7;&#x6C42;&#x8FC7;&#x7A0B;&#x4E2D;&#x7684;&#x72B6;&#x6001;&#xFF0C;&#x6709;&#x4E94;&#x4E2A;&#x503C;</p>
<ul>
<li>0:&#x8BF7;&#x6C42;&#x672A;&#x521D;&#x59CB;&#x5316;</li>
<li>1:&#x670D;&#x52A1;&#x5668;&#x8FDE;&#x63A5;&#x5DF2;&#x5EFA;&#x7ACB;</li>
<li>2:&#x8BF7;&#x6C42;&#x5DF2;&#x63A5;&#x6536;</li>
<li>3:&#x8BF7;&#x6C42;&#x5904;&#x7406;&#x4E2D;</li>
<li>4:&#x8BF7;&#x6C42;&#x5B8C;&#x6210;</li>
</ul>
</li>
<li><p>status:HTTP&#x72B6;&#x6001;&#x7801;</p>
<ul>
<li>200&#xFF1A;&#x8BF7;&#x6C42;&#x6210;&#x529F;,&#x670D;&#x52A1;&#x5668;&#x6210;&#x529F;&#x5904;&#x7406;&#x4E86;&#x8BF7;&#x6C42;</li>
<li>300&#xFF1A;&#x8BF7;&#x6C42;&#x6CA1;&#x6709;&#x6210;&#x529F;</li>
<li>304&#xFF1A;&#x8868;&#x793A;&#x8BF7;&#x6C42;&#x7684;&#x6570;&#x636E;&#x6CA1;&#x6709;&#x66F4;&#x65B0;</li>
<li>404&#xFF1A;&#x6CA1;&#x6709;&#x627E;&#x5230;&#x8BF7;&#x6C42;&#x7684;&#x6587;&#x4EF6;</li>
<li>500&#xFF1A;&#x670D;&#x52A1;&#x5668;&#x9519;&#x8BEF;</li>
</ul>
</li>
<li><p>ajax&#x7684;&#x7F3A;&#x70B9;:</p>
<ul>
<li>1&#x3001;ajax&#x5E72;&#x6389;&#x4E86;&#x6D4F;&#x89C8;&#x5668;&#x7684;&#x56DE;&#x9000;&#x6309;&#x94AE;</li>
<li>2&#x3001;&#x5B89;&#x5168;&#x95EE;&#x9898;</li>
</ul>
</li>
</ul>
<pre><code>            var xhr = new XMLHttpRequest();//readyState&#xFF1A;1
            xhr.open(&quot;GET&quot;,&quot;js/index.json&quot;);//readyState&#xFF1A;2
            xhr.send();//readyState&#xFF1A;3
            xhr.addEventListener(&quot;readystatechange&quot;,function(){
                if(xhr.readyState == 4){
                    if(xhr.status == 200){
                        console.log(xhr);
                        //JSON.parse()&#x5C06;&#x5B57;&#x7B26;&#x8F6C;&#x6362;&#x4E3A;&#x5BF9;&#x8C61;
                        var res = JSON.parse(xhr.responseText);
                        //JSON.stringify()&#x5C06;&#x5BF9;&#x8C61;&#x8F6C;&#x5316;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;
                        //res = JSON.stringify(res);
                        //console.log(res,typeof(res));
                        paiHangBang(res);
                    }else{
                        console.log(&quot;&#x8BF7;&#x6C42;&#x5931;&#x8D25;&quot;);
                    }
                }

//                if(xhr.status == 200 &amp;&amp; xhr.readyState == 4){
//                    console.log(xhr);
//                }else{
//                    console.log(&quot;&#x8BF7;&#x6C42;&#x5931;&#x8D25;&quot;)
//                }
            });

            var ul = document.querySelector(&quot;.menu&quot;);
            function paiHangBang(res){
                for(var i=0;i&lt;res.length;i++){
                    var li = &quot;<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">&gt;</span></span>&#x6392;&#x540D;<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">&gt;</span></span>&quot;+res[i].name+&quot;<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">&gt;</span></span>&quot;+res[i].num+&quot;<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>&quot;;
                    ul.innerHTML += li;
                }
            }
</code></pre><h1 id="&#x4EC0;&#x4E48;&#x53EB;&#x8DE8;&#x57DF;&#xFF1F;">&#x4EC0;&#x4E48;&#x53EB;&#x8DE8;&#x57DF;&#xFF1F;</h1>
<ul>
<li>&#x8BF7;&#x6C42;&#x62A5;&#x4EE5;&#x4E0B;&#x9519;&#x8BEF;(No &apos;Access-Control-Allow-Origin&apos;),&#x8868;&#x793A;&#x6211;&#x4EEC;&#x8FDB;&#x884C;&#x4E86;&#x8DE8;&#x57DF;&#x8BF7;&#x6C42;</li>
<li><p>&#x53EA;&#x8981;&#x8BF7;&#x6C42;&#x7684;&#x5730;&#x5740;&#x4E0D;&#x6EE1;&#x8DB3;&#x4EE5;&#x4E0B;&#x4E09;&#x4E2A;&#x6761;&#x4EF6;&#x4E4B;&#x4E00;&#xFF0C;&#x90FD;&#x662F;&#x8DE8;&#x57DF;&#x8BF7;&#x6C42;</p>
<ul>
<li>1&#x3001;&#x8BF7;&#x6C42;&#x7684;&#x540C;&#x534F;&#x8BAE;(http)</li>
<li>2&#x3001;&#x8BF7;&#x6C42;&#x7684;&#x540C;&#x57DF;&#x540D;(api.money.126.net)</li>
<li>3&#x3001;&#x8BF7;&#x6C42;&#x7684;&#x540C;&#x7AEF;&#x53E3;&#x53F7;(&#x9ED8;&#x8BA4;&#x7AEF;&#x53E3;&#x53F7;&#xFF1A;8080)</li>
</ul>
</li>
<li><p>jsonp&#x4E0D;&#x662F;&#x5168;&#x80FD;&#x7684;&#xFF0C;&#x56E0;&#x4E3A;&#x80FD;&#x4E0D;&#x80FD;&#x8DE8;&#x57DF;&#x8BF7;&#x6C42;&#x6700;&#x7EC8;&#x51B3;&#x5B9A;&#x6743;&#x5728;&#x540E;&#x53F0;&#x4EBA;&#x5458;&#x624B;&#x4E2D;</p>
</li>
<li>&#x540C;&#x6E90;&#x7B56;&#x7565;.&#x540C;&#x6E90;:&#x6307;&#x7684;&#x662F;&#x540C;&#x534F;&#x8BAE;&#x3001;&#x540C;&#x57DF;&#x540D;&#x3001;&#x540C;&#x7AEF;&#x53E3;&#x53F7;&#x3002;</li>
</ul>
<pre><code>            var baseUrl = &quot;http://api.money.126.net/data/feed/0000001,1399001?callback=refreshPrice&quot;;
            var xhr = new XMLHttpRequest();
            xhr.open(&quot;GET&quot;,baseUrl);
            xhr.send();
            xhr.addEventListener(&quot;readystatechange&quot;,function(){
                if(xhr.readyState == 4){//4&#x6B65;
                    if(xhr.status == 200){//&#x72B6;&#x6001;&#x7801;200
                        console.log(xhr);
                        var res = xhr.responseText;
                        refreshPrice(res);
                    }
                }
            })
            function refreshPrice(res){
                var res = eval(res);
                if(res != undefined){
                    console.log(res);
                    console.log(res[&quot;1399001&quot;].name);
                }
//                var res = JSON.parse(res);
            }
</code></pre><ul>
<li>&#x89E3;&#x51B3;&#x8DE8;&#x57DF;&#x95EE;&#x9898;&#xFF1A;1&#x3001;jsonp<ul>
<li>a.&#x52A8;&#x6001;&#x521B;&#x5EFA;script&#x6807;&#x7B7E;</li>
<li>b.&#x628A;&#x8BF7;&#x6C42;&#x5730;&#x5740;&#x8D4B;&#x503C;&#x7ED9;&#x521B;&#x5EFA;&#x7684;script&#x7684;src&#x5C5E;&#x6027;</li>
<li>c.&#x628A;&#x521B;&#x5EFA;&#x7684;&#x6807;&#x7B7E;&#x6DFB;&#x52A0;&#x5230;html&#x6587;&#x6863;</li>
</ul>
</li>
</ul>
<pre><code>//            var spt = document.createElement(&quot;script&quot;);
//            spt.src = &quot;http://api.money.126.net/data/feed/0000001,1399001?callback=refreshPrice&quot;;
//            document.body.appendChild(spt);
//            function refreshPrice(res){
//                console.log(res);
//            }

            //&#x5C01;&#x88C5;jsonp&#x8BF7;&#x6C42;
//            var baseUrl = &quot;http://api.money.126.net/data/feed/0000001,1399001?callback=refreshPrice&quot;;    
//            function creatEle(Url,el,parentEl){//&#x521B;&#x5EFA;&#x5143;&#x7D20;&#x51FD;&#x6570;
//                var spt = document.createElement(el);
//                var ptEl = document.querySelector(parentEl);
//                spt.src = Url;
//                ptEl.appendChild(spt);
//            }
//            creatEle(baseUrl,&quot;script&quot;,&quot;body&quot;);
//            function refreshPrice(res){
//                console.log(res);
//            }
//            creatEle(&quot;&quot;,&quot;div&quot;,&quot;body&quot;)
</code></pre>
                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../DOM/5、移动端事件.html" class="navigation navigation-prev " aria-label="Previous page: 移动端事件"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../Ajax/Ajax的实现过程.html" class="navigation navigation-next " aria-label="Next page: Ajax的实现过程"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="../gitbook/plugins/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-livereload/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"prism":{"css":["prismjs/themes/prism-solarizedlight.css"]},"emphasize":{},"expandable-chapters":{},"fontsettings":{"theme":"white","family":"sans","size":2},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"livereload":{}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
